<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>
        {% block title %}
        学生成绩管理系统
        {% endblock %}
    </title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.6/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-4Q6Gf2aSP4eDXB8Miphtr37CMZZQ5oXLH2yaXMJ2w8e2ZtHTl7GptT4jmndRuHDT" crossorigin="anonymous">
    <link rel="stylesheet" href="{{ url_for('static', filename='css/admin/base.css') }}">
    {% block extra_css %}{% endblock %}
</head>
<body>
    <div class="wrapper">
<!--        侧边栏-->
        <div id="sidebar">
            <div class="sidebar-header">
                <h3>成绩管理系统</h3>
            </div>

<!--            侧边栏的列表-->
            <ul class="list-unstyled components">
                <li class="active">
                    <a href="/admin/home">
                        <i class="fas fa-home"></i>
                        首页
                    </a>
                </li>

                {% if session.get('role') == '0'%}
                <li>
                    <a href="/admin/score">
                        <i class="fas fa-chart-bar"></i>
                        成绩查询
                    </a>
                </li>
                {% endif %}
                {% if session.get('role') == '1' or session.get('role') == '2'%}
                <li>
                    <a href="/admin/score">
                        <i class="fas fa-chart-bar"></i>
                            成绩管理
                    </a>
                </li>
                <li>
                    <a href="/admin/student">
                        <i class="fas fa-user-graduate"></i>
                        学生管理
                    </a>
                </li>

                <li>
                    <a href="/admin/course">
                        <i class="fas fa-book"></i>
                        课程管理
                    </a>
                </li>
                <li>
                    <a href="/admin/class">
                        <i class="fas fa-users"></i>
                        班级管理
                    </a>
                </li>
                {% endif %}
                {% if session.get('role') == '2'%}
                <li>
                    <a href="/admin/admins">
                        <i class="fas fa-users"></i>
                        管理员管理
                    </a>
                </li>
                {% endif %}

            </ul>
        </div>

        <!-- 页面内容 -->
        <div id="content">
            <!-- 顶部导航栏 -->
            <nav class="navbar navbar-expand-lg navbar-dark">
                <div class="container-fluid">
                    <button type="button" id="sidebarCollapse" class="btn btn-info btn-sm">
                        <<
                        >>
                    </button>
                    <div class="navbar-brand">学生成绩管理系统</div>
                    <div class="ms-auto d-flex align-items-center">
                        {% if session.get('role') == '0'%}
                        <span class="text-light me-3">
                            <i class="fas fa-user"></i>
                            {{ session.get('sno', '未登录') }},{{session.get('name', '未登录')}}
                        </span>
                        {% else %}
                        <span class="text-light me-3">
                            <i class="fas fa-user"></i>
                            {{ session.get('username', '未登录') }}
                        </span>
                        {% endif %}

                        <a href="/admin/logout" class="btn btn-danger btn-outline-light btn-sm">
                            <i class="fas fa-sign-out-alt"></i> 退出
                        </a>
                    </div>
                </div>
            </nav>

            <!-- 主要内容区域 -->
            <div class="container-fluid content-area">
                {% block content %}{% endblock %}
            </div>
        </div>
    </div>

    <!-- Toast 通知容器 -->
    <div class="toast-container position-fixed top-0 end-0 p-3" style="z-index: 1055;">
        <!-- Toast 消息将通过JavaScript动态添加 -->
    </div>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="{{ url_for('static', filename='js/admin/base.js') }}"></script>
    <script src="{{ url_for('static', filename='js/utils/debounce.js') }}"></script>
    <script src="{{ url_for('static', filename='js/utils/showState.js') }}"></script>
    <script src="{{ url_for('static', filename='js/utils/format.js') }}"></script>
    {% block extra_js %}{% endblock %}
</body>
</html>